package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDsihMapper {


    /**
     * 根据 菜品id查询套餐
     * @return
     */
    List<Long> getSetealIdsByDishIds(List<Long> dishIds);

    /**
     * 批量插入关联菜品
     * @param setmealDishes
     */
//    @AutoFill(value = OperationType.INSERT)
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 删除套餐包含菜品
     * @param ids
     */
    void deleteByids(List<Long> ids);

    @Select("select * from setmeal_dish where setmeal_id = #{categoryId}")
    List<SetmealDish> getByid(Long categoryId);

    @Delete("delete from setmeal_dish where setmeal_id =#{id}")
    void deleteByid(Long id);
}
